package com.exam.Mapper;

import com.exam.Entity.Admin;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AdminMapper {

    @Select("select id,name from admin")
    List<Admin> findAll();

    @Select("select id,name from admin where id = #{id}")
    Admin findById(Integer adminId);

    @Delete("delete from admin where adminId = #{id}")
    int deleteById(int adminId);

    @Update("update admin set name = #{name},password = #{password},account = #{account} where id = #{id}")
    int update(Admin admin);

    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("insert into admin(name,password,account) " +
            "values(#{name},#{password},#{account})")
    int add(Admin admin);
}
